<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>N-ary Trees</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.73.2">
<link rel="start" href="index.html" title="GLib Reference Manual">
<link rel="up" href="glib-data-types.html" title="GLib Data Types">
<link rel="prev" href="glib-Balanced-Binary-Trees.html" title="Balanced Binary Trees">
<link rel="next" href="glib-Quarks.html" title="Quarks">
<meta name="generator" content="GTK-Doc V1.9 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
<link rel="chapter" href="glib.html" title="GLib Overview">
<link rel="chapter" href="glib-fundamentals.html" title="GLib Fundamentals">
<link rel="chapter" href="glib-core.html" title="GLib Core Application Support">
<link rel="chapter" href="glib-utilities.html" title="GLib Utilities">
<link rel="chapter" href="glib-data-types.html" title="GLib Data Types">
<link rel="chapter" href="tools.html" title="GLib Tools">
<link rel="index" href="ix01.html" title="Index">
<link rel="index" href="ix02.html" title="Index of deprecated symbols">
<link rel="index" href="ix03.html" title="Index of new symbols in 2.2">
<link rel="index" href="ix04.html" title="Index of new symbols in 2.4">
<link rel="index" href="ix05.html" title="Index of new symbols in 2.6">
<link rel="index" href="ix06.html" title="Index of new symbols in 2.8">
<link rel="index" href="ix07.html" title="Index of new symbols in 2.10">
<link rel="index" href="ix08.html" title="Index of new symbols in 2.12">
<link rel="index" href="ix09.html" title="Index of new symbols in 2.14">
<link rel="index" href="ix10.html" title="Index of new symbols in 2.16">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
<tr valign="middle">
<td><a accesskey="p" href="glib-Balanced-Binary-Trees.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="glib-data-types.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">GLib Reference Manual</th>
<td><a accesskey="n" href="glib-Quarks.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts"><nobr><a href="#id3393396" class="shortcut">Top</a>
                  &#160;|&#160;
                  <a href="#id3394452" class="shortcut">Description</a></nobr></td></tr>
</table>
<div class="refentry" lang="en">
<a name="glib-N-ary-Trees"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2>
<a name="id3393396"></a><span class="refentrytitle">N-ary Trees</span>
</h2>
<p>N-ary Trees &#8212; trees of data with any number of branches</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<h2>Synopsis</h2>
<pre class="synopsis">

#include &lt;glib.h&gt;


                    <a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a>;
<a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a>*              <a class="link" href="glib-N-ary-Trees.html#g-node-new">g_node_new</a>                          (<a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> data);
<a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a>*              <a class="link" href="glib-N-ary-Trees.html#g-node-copy">g_node_copy</a>                         (<a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a> *node);
<a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a>            (<a class="link" href="glib-N-ary-Trees.html#GCopyFunc">*GCopyFunc</a>)                        (<a class="link" href="glib-Basic-Types.html#gconstpointer">gconstpointer</a> src,
                                                         <a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> data);
<a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a>*              <a class="link" href="glib-N-ary-Trees.html#g-node-copy-deep">g_node_copy_deep</a>                    (<a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a> *node,
                                                         <a class="link" href="glib-N-ary-Trees.html#GCopyFunc">GCopyFunc</a> copy_func,
                                                         <a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> data);

<a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a>*              <a class="link" href="glib-N-ary-Trees.html#g-node-insert">g_node_insert</a>                       (<a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a> *parent,
                                                         <a class="link" href="glib-Basic-Types.html#gint">gint</a> position,
                                                         <a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a> *node);
<a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a>*              <a class="link" href="glib-N-ary-Trees.html#g-node-insert-before">g_node_insert_before</a>                (<a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a> *parent,
                                                         <a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a> *sibling,
                                                         <a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a> *node);
<a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a>*              <a class="link" href="glib-N-ary-Trees.html#g-node-insert-after">g_node_insert_after</a>                 (<a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a> *parent,
                                                         <a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a> *sibling,
                                                         <a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a> *node);
#define             <a class="link" href="glib-N-ary-Trees.html#g-node-append">g_node_append</a>                       (parent, node)
<a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a>*              <a class="link" href="glib-N-ary-Trees.html#g-node-prepend">g_node_prepend</a>                      (<a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a> *parent,
                                                         <a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a> *node);

#define             <a class="link" href="glib-N-ary-Trees.html#g-node-insert-data">g_node_insert_data</a>                  (parent, position, data)
#define             <a class="link" href="glib-N-ary-Trees.html#g-node-insert-data-before">g_node_insert_data_before</a>           (parent, sibling, data)
#define             <a class="link" href="glib-N-ary-Trees.html#g-node-append-data">g_node_append_data</a>                  (parent, data)
#define             <a class="link" href="glib-N-ary-Trees.html#g-node-prepend-data">g_node_prepend_data</a>                 (parent, data)

void                <a class="link" href="glib-N-ary-Trees.html#g-node-reverse-children">g_node_reverse_children</a>             (<a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a> *node);
void                <a class="link" href="glib-N-ary-Trees.html#g-node-traverse">g_node_traverse</a>                     (<a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a> *root,
                                                         <a class="link" href="glib-Balanced-Binary-Trees.html#GTraverseType">GTraverseType</a> order,
                                                         <a class="link" href="glib-N-ary-Trees.html#GTraverseFlags">GTraverseFlags</a> flags,
                                                         <a class="link" href="glib-Basic-Types.html#gint">gint</a> max_depth,
                                                         <a class="link" href="glib-N-ary-Trees.html#GNodeTraverseFunc">GNodeTraverseFunc</a> func,
                                                         <a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> data);
enum                <a class="link" href="glib-N-ary-Trees.html#GTraverseFlags">GTraverseFlags</a>;
<a class="link" href="glib-Basic-Types.html#gboolean">gboolean</a>            (<a class="link" href="glib-N-ary-Trees.html#GNodeTraverseFunc">*GNodeTraverseFunc</a>)                (<a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a> *node,
                                                         <a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> data);
void                <a class="link" href="glib-N-ary-Trees.html#g-node-children-foreach">g_node_children_foreach</a>             (<a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a> *node,
                                                         <a class="link" href="glib-N-ary-Trees.html#GTraverseFlags">GTraverseFlags</a> flags,
                                                         <a class="link" href="glib-N-ary-Trees.html#GNodeForeachFunc">GNodeForeachFunc</a> func,
                                                         <a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> data);
void                (<a class="link" href="glib-N-ary-Trees.html#GNodeForeachFunc">*GNodeForeachFunc</a>)                 (<a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a> *node,
                                                         <a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> data);

<a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a>*              <a class="link" href="glib-N-ary-Trees.html#g-node-get-root">g_node_get_root</a>                     (<a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a> *node);
<a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a>*              <a class="link" href="glib-N-ary-Trees.html#g-node-find">g_node_find</a>                         (<a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a> *root,
                                                         <a class="link" href="glib-Balanced-Binary-Trees.html#GTraverseType">GTraverseType</a> order,
                                                         <a class="link" href="glib-N-ary-Trees.html#GTraverseFlags">GTraverseFlags</a> flags,
                                                         <a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> data);
<a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a>*              <a class="link" href="glib-N-ary-Trees.html#g-node-find-child">g_node_find_child</a>                   (<a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a> *node,
                                                         <a class="link" href="glib-N-ary-Trees.html#GTraverseFlags">GTraverseFlags</a> flags,
                                                         <a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> data);
<a class="link" href="glib-Basic-Types.html#gint">gint</a>                <a class="link" href="glib-N-ary-Trees.html#g-node-child-index">g_node_child_index</a>                  (<a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a> *node,
                                                         <a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> data);
<a class="link" href="glib-Basic-Types.html#gint">gint</a>                <a class="link" href="glib-N-ary-Trees.html#g-node-child-position">g_node_child_position</a>               (<a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a> *node,
                                                         <a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a> *child);
#define             <a class="link" href="glib-N-ary-Trees.html#g-node-first-child">g_node_first_child</a>                  (node)
<a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a>*              <a class="link" href="glib-N-ary-Trees.html#g-node-last-child">g_node_last_child</a>                   (<a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a> *node);
<a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a>*              <a class="link" href="glib-N-ary-Trees.html#g-node-nth-child">g_node_nth_child</a>                    (<a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a> *node,
                                                         <a class="link" href="glib-Basic-Types.html#guint">guint</a> n);
<a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a>*              <a class="link" href="glib-N-ary-Trees.html#g-node-first-sibling">g_node_first_sibling</a>                (<a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a> *node);
#define             <a class="link" href="glib-N-ary-Trees.html#g-node-next-sibling">g_node_next_sibling</a>                 (node)
#define             <a class="link" href="glib-N-ary-Trees.html#g-node-prev-sibling">g_node_prev_sibling</a>                 (node)
<a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a>*              <a class="link" href="glib-N-ary-Trees.html#g-node-last-sibling">g_node_last_sibling</a>                 (<a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a> *node);

#define             <a class="link" href="glib-N-ary-Trees.html#G-NODE-IS-LEAF:CAPS">G_NODE_IS_LEAF</a>                      (node)
#define             <a class="link" href="glib-N-ary-Trees.html#G-NODE-IS-ROOT:CAPS">G_NODE_IS_ROOT</a>                      (node)
<a class="link" href="glib-Basic-Types.html#guint">guint</a>               <a class="link" href="glib-N-ary-Trees.html#g-node-depth">g_node_depth</a>                        (<a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a> *node);
<a class="link" href="glib-Basic-Types.html#guint">guint</a>               <a class="link" href="glib-N-ary-Trees.html#g-node-n-nodes">g_node_n_nodes</a>                      (<a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a> *root,
                                                         <a class="link" href="glib-N-ary-Trees.html#GTraverseFlags">GTraverseFlags</a> flags);
<a class="link" href="glib-Basic-Types.html#guint">guint</a>               <a class="link" href="glib-N-ary-Trees.html#g-node-n-children">g_node_n_children</a>                   (<a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a> *node);
<a class="link" href="glib-Basic-Types.html#gboolean">gboolean</a>            <a class="link" href="glib-N-ary-Trees.html#g-node-is-ancestor">g_node_is_ancestor</a>                  (<a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a> *node,
                                                         <a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a> *descendant);
<a class="link" href="glib-Basic-Types.html#guint">guint</a>               <a class="link" href="glib-N-ary-Trees.html#g-node-max-height">g_node_max_height</a>                   (<a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a> *root);

void                <a class="link" href="glib-N-ary-Trees.html#g-node-unlink">g_node_unlink</a>                       (<a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a> *node);
void                <a class="link" href="glib-N-ary-Trees.html#g-node-destroy">g_node_destroy</a>                      (<a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a> *root);

void                <a class="link" href="glib-N-ary-Trees.html#g-node-push-allocator">g_node_push_allocator</a>               (<a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> dummy);
void                <a class="link" href="glib-N-ary-Trees.html#g-node-pop-allocator">g_node_pop_allocator</a>                (void);
</pre>
</div>
<div class="refsect1" lang="en">
<a name="id3394452"></a><h2>Description</h2>
<p>
The <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> struct and its associated functions provide a N-ary tree data
structure, where nodes in the tree can contain arbitrary data.
</p>
<p>
To create a new tree use <a class="link" href="glib-N-ary-Trees.html#g-node-new"><code class="function">g_node_new()</code></a>.
</p>
<p>
To insert a node into a tree use <a class="link" href="glib-N-ary-Trees.html#g-node-insert"><code class="function">g_node_insert()</code></a>, <a class="link" href="glib-N-ary-Trees.html#g-node-insert-before"><code class="function">g_node_insert_before()</code></a>,
<a class="link" href="glib-N-ary-Trees.html#g-node-append"><code class="function">g_node_append()</code></a> and <a class="link" href="glib-N-ary-Trees.html#g-node-prepend"><code class="function">g_node_prepend()</code></a>.
</p>
<p>
To create a new node and insert it into a tree use <a class="link" href="glib-N-ary-Trees.html#g-node-insert-data"><code class="function">g_node_insert_data()</code></a>, 
<a class="link" href="glib-N-ary-Trees.html#g-node-insert-data-before"><code class="function">g_node_insert_data_before()</code></a>, <a class="link" href="glib-N-ary-Trees.html#g-node-append-data"><code class="function">g_node_append_data()</code></a> and <a class="link" href="glib-N-ary-Trees.html#g-node-prepend-data"><code class="function">g_node_prepend_data()</code></a>.
</p>
<p>
To reverse the children of a node use <a class="link" href="glib-N-ary-Trees.html#g-node-reverse-children"><code class="function">g_node_reverse_children()</code></a>.
</p>
<p>
To find a node use <a class="link" href="glib-N-ary-Trees.html#g-node-get-root"><code class="function">g_node_get_root()</code></a>, <a class="link" href="glib-N-ary-Trees.html#g-node-find"><code class="function">g_node_find()</code></a>, <a class="link" href="glib-N-ary-Trees.html#g-node-find-child"><code class="function">g_node_find_child()</code></a>,
<a class="link" href="glib-N-ary-Trees.html#g-node-child-index"><code class="function">g_node_child_index()</code></a>, <a class="link" href="glib-N-ary-Trees.html#g-node-child-position"><code class="function">g_node_child_position()</code></a>, 
<a class="link" href="glib-N-ary-Trees.html#g-node-first-child"><code class="function">g_node_first_child()</code></a>, <a class="link" href="glib-N-ary-Trees.html#g-node-last-child"><code class="function">g_node_last_child()</code></a>,
<a class="link" href="glib-N-ary-Trees.html#g-node-nth-child"><code class="function">g_node_nth_child()</code></a>, <a class="link" href="glib-N-ary-Trees.html#g-node-first-sibling"><code class="function">g_node_first_sibling()</code></a>, <a class="link" href="glib-N-ary-Trees.html#g-node-prev-sibling"><code class="function">g_node_prev_sibling()</code></a>,
<a class="link" href="glib-N-ary-Trees.html#g-node-next-sibling"><code class="function">g_node_next_sibling()</code></a> or <a class="link" href="glib-N-ary-Trees.html#g-node-last-sibling"><code class="function">g_node_last_sibling()</code></a>.
</p>
<p>
To get information about a node or tree use <a class="link" href="glib-N-ary-Trees.html#G-NODE-IS-LEAF:CAPS"><code class="function">G_NODE_IS_LEAF()</code></a>,
<a class="link" href="glib-N-ary-Trees.html#G-NODE-IS-ROOT:CAPS"><code class="function">G_NODE_IS_ROOT()</code></a>, <a class="link" href="glib-N-ary-Trees.html#g-node-depth"><code class="function">g_node_depth()</code></a>, <a class="link" href="glib-N-ary-Trees.html#g-node-n-nodes"><code class="function">g_node_n_nodes()</code></a>, <a class="link" href="glib-N-ary-Trees.html#g-node-n-children"><code class="function">g_node_n_children()</code></a>,
<a class="link" href="glib-N-ary-Trees.html#g-node-is-ancestor"><code class="function">g_node_is_ancestor()</code></a> or <a class="link" href="glib-N-ary-Trees.html#g-node-max-height"><code class="function">g_node_max_height()</code></a>.
</p>
<p>
To traverse a tree, calling a function for each node visited in the
traversal, use <a class="link" href="glib-N-ary-Trees.html#g-node-traverse"><code class="function">g_node_traverse()</code></a> or <a class="link" href="glib-N-ary-Trees.html#g-node-children-foreach"><code class="function">g_node_children_foreach()</code></a>.
</p>
<p>
To remove a node or subtree from a tree use <a class="link" href="glib-N-ary-Trees.html#g-node-unlink"><code class="function">g_node_unlink()</code></a> or
<a class="link" href="glib-N-ary-Trees.html#g-node-destroy"><code class="function">g_node_destroy()</code></a>.
</p>
</div>
<div class="refsect1" lang="en">
<a name="id3394857"></a><h2>Details</h2>
<div class="refsect2" lang="en">
<a name="id3394868"></a><h3>
<a name="GNode"></a>GNode</h3>
<a class="indexterm" name="id3394880"></a><pre class="programlisting">typedef struct {
  gpointer data;
  GNode	  *next;
  GNode	  *prev;
  GNode	  *parent;
  GNode	  *children;
} GNode;
</pre>
<p>
The <span class="structname">GNode</span> struct represents one node in a
<a class="link" href="glib-N-ary-Trees.html" title="N-ary Trees">N-ary Tree</a>.
fields 
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a>&#160;<em class="structfield"><code>data</code></em>;</span></p></td>
<td>contains the actual data of the node.
</td>
</tr>
<tr>
<td><p><span class="term"><a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a>&#160;*<em class="structfield"><code>next</code></em>;</span></p></td>
<td>points to the node's next sibling (a sibling is another 
  <span class="structname">GNode</span> with the same parent).
</td>
</tr>
<tr>
<td><p><span class="term"><a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a>&#160;*<em class="structfield"><code>prev</code></em>;</span></p></td>
<td>points to the node's previous sibling.
</td>
</tr>
<tr>
<td><p><span class="term"><a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a>&#160;*<em class="structfield"><code>parent</code></em>;</span></p></td>
<td>points to the parent of the <span class="structname">GNode</span>,
  or is <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if the <span class="structname">GNode</span> is the root of the tree.
</td>
</tr>
<tr>
<td><p><span class="term"><a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a>&#160;*<em class="structfield"><code>children</code></em>;</span></p></td>
<td>The <em class="structfield"><code>children</code></em> field points to the first 
  child of the <span class="structname">GNode</span>. The other children are accessed 
  by using the <em class="structfield"><code>next</code></em> pointer of each child.

</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3395051"></a><h3>
<a name="g-node-new"></a>g_node_new ()</h3>
<a class="indexterm" name="id3395063"></a><pre class="programlisting"><a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a>*              g_node_new                          (<a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> data);</pre>
<p>
Creates a new <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> containing the given data.
Used to create the first node in a tree.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>data</code></em>&#160;:</span></p></td>
<td> the data of the new node
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
<td> a new <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3395141"></a><h3>
<a name="g-node-copy"></a>g_node_copy ()</h3>
<a class="indexterm" name="id3395153"></a><pre class="programlisting"><a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a>*              g_node_copy                         (<a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a> *node);</pre>
<p>
Recursively copies a <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> (but does not deep-copy the data inside the 
nodes, see <a class="link" href="glib-N-ary-Trees.html#g-node-copy-deep"><code class="function">g_node_copy_deep()</code></a> if you need that).</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>node</code></em>&#160;:</span></p></td>
<td> a <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
<td> a new <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> containing the same data pointers
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3395249"></a><h3>
<a name="GCopyFunc"></a>GCopyFunc ()</h3>
<a class="indexterm" name="id3395264"></a><pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a>            (*GCopyFunc)                        (<a class="link" href="glib-Basic-Types.html#gconstpointer">gconstpointer</a> src,
                                                         <a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> data);</pre>
<p>
A function of this signature is used to copy the node data 
when doing a deep-copy of a tree.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>src</code></em>&#160;:</span></p></td>
<td> A pointer to the data which should be copied
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>data</code></em>&#160;:</span></p></td>
<td> Additional data
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
<td> A pointer to the copy

</td>
</tr>
</tbody>
</table></div>
<p class="since">Since  2.4
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3395354"></a><h3>
<a name="g-node-copy-deep"></a>g_node_copy_deep ()</h3>
<a class="indexterm" name="id3395369"></a><pre class="programlisting"><a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a>*              g_node_copy_deep                    (<a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a> *node,
                                                         <a class="link" href="glib-N-ary-Trees.html#GCopyFunc">GCopyFunc</a> copy_func,
                                                         <a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> data);</pre>
<p>
Recursively copies a <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> and its data.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>node</code></em>&#160;:</span></p></td>
<td> a <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>copy_func</code></em>&#160;:</span></p></td>
<td> the function which is called to copy the data inside each node,
  or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to use the original data.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>data</code></em>&#160;:</span></p></td>
<td> data to pass to <em class="parameter"><code>copy_func</code></em>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
<td> a new <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> containing copies of the data in <em class="parameter"><code>node</code></em>.

</td>
</tr>
</tbody>
</table></div>
<p class="since">Since  2.4
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3395527"></a><h3>
<a name="g-node-insert"></a>g_node_insert ()</h3>
<a class="indexterm" name="id3395540"></a><pre class="programlisting"><a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a>*              g_node_insert                       (<a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a> *parent,
                                                         <a class="link" href="glib-Basic-Types.html#gint">gint</a> position,
                                                         <a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a> *node);</pre>
<p>
Inserts a <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> beneath the parent at the given position.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>parent</code></em>&#160;:</span></p></td>
<td> the <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> to place <em class="parameter"><code>node</code></em> under
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>position</code></em>&#160;:</span></p></td>
<td> the position to place <em class="parameter"><code>node</code></em> at, with respect to its siblings
    If position is -1, <em class="parameter"><code>node</code></em> is inserted as the last child of <em class="parameter"><code>parent</code></em>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>node</code></em>&#160;:</span></p></td>
<td> the <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> to insert
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
<td> the inserted <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3395701"></a><h3>
<a name="g-node-insert-before"></a>g_node_insert_before ()</h3>
<a class="indexterm" name="id3395714"></a><pre class="programlisting"><a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a>*              g_node_insert_before                (<a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a> *parent,
                                                         <a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a> *sibling,
                                                         <a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a> *node);</pre>
<p>
Inserts a <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> beneath the parent before the given sibling.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>parent</code></em>&#160;:</span></p></td>
<td> the <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> to place <em class="parameter"><code>node</code></em> under
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>sibling</code></em>&#160;:</span></p></td>
<td> the sibling <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> to place <em class="parameter"><code>node</code></em> before. 
    If sibling is <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>, the node is inserted as the last child of <em class="parameter"><code>parent</code></em>.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>node</code></em>&#160;:</span></p></td>
<td> the <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> to insert
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
<td> the inserted <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3395888"></a><h3>
<a name="g-node-insert-after"></a>g_node_insert_after ()</h3>
<a class="indexterm" name="id3395901"></a><pre class="programlisting"><a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a>*              g_node_insert_after                 (<a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a> *parent,
                                                         <a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a> *sibling,
                                                         <a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a> *node);</pre>
<p>
Inserts a <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> beneath the parent after the given sibling.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>parent</code></em>&#160;:</span></p></td>
<td> the <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> to place <em class="parameter"><code>node</code></em> under
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>sibling</code></em>&#160;:</span></p></td>
<td> the sibling <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> to place <em class="parameter"><code>node</code></em> after. 
    If sibling is <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>, the node is inserted as the first child of <em class="parameter"><code>parent</code></em>.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>node</code></em>&#160;:</span></p></td>
<td> the <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> to insert
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
<td> the inserted <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3396074"></a><h3>
<a name="g-node-append"></a>g_node_append()</h3>
<a class="indexterm" name="id3396087"></a><pre class="programlisting">#define             g_node_append(parent, node)</pre>
<p>
Inserts a <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> as the last child of the given parent.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>parent</code></em>&#160;:</span></p></td>
<td> the <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> to place the new <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> under
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>node</code></em>&#160;:</span></p></td>
<td> the <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> to insert
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
<td> the inserted <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3396189"></a><h3>
<a name="g-node-prepend"></a>g_node_prepend ()</h3>
<a class="indexterm" name="id3396202"></a><pre class="programlisting"><a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a>*              g_node_prepend                      (<a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a> *parent,
                                                         <a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a> *node);</pre>
<p>
Inserts a <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> as the first child of the given parent.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>parent</code></em>&#160;:</span></p></td>
<td> the <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> to place the new <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> under
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>node</code></em>&#160;:</span></p></td>
<td> the <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> to insert
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
<td> the inserted <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3396324"></a><h3>
<a name="g-node-insert-data"></a>g_node_insert_data()</h3>
<a class="indexterm" name="id3396338"></a><pre class="programlisting">#define             g_node_insert_data(parent, position, data)</pre>
<p>
Inserts a new <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> at the given position.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>parent</code></em>&#160;:</span></p></td>
<td> the <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> to place the new <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> under
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>position</code></em>&#160;:</span></p></td>
<td> the position to place the new <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> at. If position is -1, 
    the new <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> is inserted as the last child of <em class="parameter"><code>parent</code></em>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>data</code></em>&#160;:</span></p></td>
<td> the data for the new <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
<td> the new <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3396476"></a><h3>
<a name="g-node-insert-data-before"></a>g_node_insert_data_before()</h3>
<a class="indexterm" name="id3396489"></a><pre class="programlisting">#define             g_node_insert_data_before(parent, sibling, data)</pre>
<p>
Inserts a new <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> before the given sibling.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>parent</code></em>&#160;:</span></p></td>
<td> the <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> to place the new <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> under
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>sibling</code></em>&#160;:</span></p></td>
<td> the sibling <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> to place the new <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> before
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>data</code></em>&#160;:</span></p></td>
<td> the data for the new <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
<td> the new <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3396621"></a><h3>
<a name="g-node-append-data"></a>g_node_append_data()</h3>
<a class="indexterm" name="id3396634"></a><pre class="programlisting">#define             g_node_append_data(parent, data)</pre>
<p>
Inserts a new <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> as the last child of the given parent.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>parent</code></em>&#160;:</span></p></td>
<td> the <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> to place the new <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> under
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>data</code></em>&#160;:</span></p></td>
<td> the data for the new <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
<td> the new <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3396735"></a><h3>
<a name="g-node-prepend-data"></a>g_node_prepend_data()</h3>
<a class="indexterm" name="id3396749"></a><pre class="programlisting">#define             g_node_prepend_data(parent, data)</pre>
<p>
Inserts a new <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> as the first child of the given parent.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>parent</code></em>&#160;:</span></p></td>
<td> the <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> to place the new <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> under
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>data</code></em>&#160;:</span></p></td>
<td> the data for the new <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
<td> the new <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3396850"></a><h3>
<a name="g-node-reverse-children"></a>g_node_reverse_children ()</h3>
<a class="indexterm" name="id3396864"></a><pre class="programlisting">void                g_node_reverse_children             (<a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a> *node);</pre>
<p>
Reverses the order of the children of a <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>.
(It doesn't change the order of the grandchildren.)</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><em class="parameter"><code>node</code></em>&#160;:</span></p></td>
<td> a <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>.
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3396931"></a><h3>
<a name="g-node-traverse"></a>g_node_traverse ()</h3>
<a class="indexterm" name="id3396944"></a><pre class="programlisting">void                g_node_traverse                     (<a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a> *root,
                                                         <a class="link" href="glib-Balanced-Binary-Trees.html#GTraverseType">GTraverseType</a> order,
                                                         <a class="link" href="glib-N-ary-Trees.html#GTraverseFlags">GTraverseFlags</a> flags,
                                                         <a class="link" href="glib-Basic-Types.html#gint">gint</a> max_depth,
                                                         <a class="link" href="glib-N-ary-Trees.html#GNodeTraverseFunc">GNodeTraverseFunc</a> func,
                                                         <a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> data);</pre>
<p>
Traverses a tree starting at the given root <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>.
It calls the given function for each node visited.
The traversal can be halted at any point by returning <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> from <em class="parameter"><code>func</code></em>.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>root</code></em>&#160;:</span></p></td>
<td> the root <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> of the tree to traverse
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>order</code></em>&#160;:</span></p></td>
<td> the order in which nodes are visited - <a class="link" href="glib-Balanced-Binary-Trees.html#G-IN-ORDER:CAPS"><code class="literal">G_IN_ORDER</code></a>, 
    <a class="link" href="glib-Balanced-Binary-Trees.html#G-PRE-ORDER:CAPS"><code class="literal">G_PRE_ORDER</code></a>, <a class="link" href="glib-Balanced-Binary-Trees.html#G-POST-ORDER:CAPS"><code class="literal">G_POST_ORDER</code></a>, or <a class="link" href="glib-Balanced-Binary-Trees.html#G-LEVEL-ORDER:CAPS"><code class="literal">G_LEVEL_ORDER</code></a>.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>flags</code></em>&#160;:</span></p></td>
<td> which types of children are to be visited, one of 
    <a class="link" href="glib-N-ary-Trees.html#G-TRAVERSE-ALL:CAPS"><code class="literal">G_TRAVERSE_ALL</code></a>, <a class="link" href="glib-N-ary-Trees.html#G-TRAVERSE-LEAVES:CAPS"><code class="literal">G_TRAVERSE_LEAVES</code></a> and <a class="link" href="glib-N-ary-Trees.html#G-TRAVERSE-NON-LEAVES:CAPS"><code class="literal">G_TRAVERSE_NON_LEAVES</code></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>max_depth</code></em>&#160;:</span></p></td>
<td> the maximum depth of the traversal. Nodes below this
    depth will not be visited. If max_depth is -1 all nodes in 
    the tree are visited. If depth is 1, only the root is visited. 
    If depth is 2, the root and its children are visited. And so on.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>func</code></em>&#160;:</span></p></td>
<td> the function to call for each visited <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>data</code></em>&#160;:</span></p></td>
<td> user data to pass to the function
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3397229"></a><h3>
<a name="GTraverseFlags"></a>enum GTraverseFlags</h3>
<a class="indexterm" name="id3397242"></a><pre class="programlisting">typedef enum
{
  G_TRAVERSE_LEAVES     = 1 &lt;&lt; 0,
  G_TRAVERSE_NON_LEAVES = 1 &lt;&lt; 1,
  G_TRAVERSE_ALL        = G_TRAVERSE_LEAVES | G_TRAVERSE_NON_LEAVES,
  G_TRAVERSE_MASK       = 0x03,
  G_TRAVERSE_LEAFS      = G_TRAVERSE_LEAVES,
  G_TRAVERSE_NON_LEAFS  = G_TRAVERSE_NON_LEAVES
} GTraverseFlags;
</pre>
<p>
Specifies which nodes are visited during several of the tree functions,
including <a class="link" href="glib-N-ary-Trees.html#g-node-traverse"><code class="function">g_node_traverse()</code></a> and <a class="link" href="glib-N-ary-Trees.html#g-node-find"><code class="function">g_node_find()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><a name="G-TRAVERSE-LEAVES:CAPS"></a><code class="literal">G_TRAVERSE_LEAVES</code></span></p></td>
<td>only leaf nodes should be visited. This name has been
  introduced in 2.6, for older version use <a class="link" href="glib-N-ary-Trees.html#G-TRAVERSE-LEAFS:CAPS"><code class="literal">G_TRAVERSE_LEAFS</code></a>.
</td>
</tr>
<tr>
<td><p><span class="term"><a name="G-TRAVERSE-NON-LEAVES:CAPS"></a><code class="literal">G_TRAVERSE_NON_LEAVES</code></span></p></td>
<td>only non-leaf nodes should be visited. This name 
  has been introduced in 2.6, for older version use <a class="link" href="glib-N-ary-Trees.html#G-TRAVERSE-NON-LEAFS:CAPS"><code class="literal">G_TRAVERSE_NON_LEAFS</code></a>.
</td>
</tr>
<tr>
<td><p><span class="term"><a name="G-TRAVERSE-ALL:CAPS"></a><code class="literal">G_TRAVERSE_ALL</code></span></p></td>
<td>all nodes should be visited.
</td>
</tr>
<tr>
<td><p><span class="term"><a name="G-TRAVERSE-MASK:CAPS"></a><code class="literal">G_TRAVERSE_MASK</code></span></p></td>
<td>a mask of all traverse flags.
</td>
</tr>
<tr>
<td><p><span class="term"><a name="G-TRAVERSE-LEAFS:CAPS"></a><code class="literal">G_TRAVERSE_LEAFS</code></span></p></td>
<td>identical to <a class="link" href="glib-N-ary-Trees.html#G-TRAVERSE-LEAVES:CAPS"><code class="literal">G_TRAVERSE_LEAVES</code></a>.
</td>
</tr>
<tr>
<td><p><span class="term"><a name="G-TRAVERSE-NON-LEAFS:CAPS"></a><code class="literal">G_TRAVERSE_NON_LEAFS</code></span></p></td>
<td>identical to <a class="link" href="glib-N-ary-Trees.html#G-TRAVERSE-NON-LEAVES:CAPS"><code class="literal">G_TRAVERSE_NON_LEAVES</code></a>.

</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3397473"></a><h3>
<a name="GNodeTraverseFunc"></a>GNodeTraverseFunc ()</h3>
<a class="indexterm" name="id3397487"></a><pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean">gboolean</a>            (*GNodeTraverseFunc)                (<a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a> *node,
                                                         <a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> data);</pre>
<p>
Specifies the type of function passed to <a class="link" href="glib-N-ary-Trees.html#g-node-traverse"><code class="function">g_node_traverse()</code></a>.
The function is called with each of the nodes visited, together with the
user data passed to <a class="link" href="glib-N-ary-Trees.html#g-node-traverse"><code class="function">g_node_traverse()</code></a>.
If the function returns <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a>, then the traversal is stopped.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>node</code></em>&#160;:</span></p></td>
<td>a <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>data</code></em>&#160;:</span></p></td>
<td>user data passed to <a class="link" href="glib-N-ary-Trees.html#g-node-traverse"><code class="function">g_node_traverse()</code></a>.
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
<td>
<a class="link" href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> to stop the traversal.


</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3397626"></a><h3>
<a name="g-node-children-foreach"></a>g_node_children_foreach ()</h3>
<a class="indexterm" name="id3397640"></a><pre class="programlisting">void                g_node_children_foreach             (<a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a> *node,
                                                         <a class="link" href="glib-N-ary-Trees.html#GTraverseFlags">GTraverseFlags</a> flags,
                                                         <a class="link" href="glib-N-ary-Trees.html#GNodeForeachFunc">GNodeForeachFunc</a> func,
                                                         <a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> data);</pre>
<p>
Calls a function for each of the children of a <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>.
Note that it doesn't descend beneath the child nodes.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>node</code></em>&#160;:</span></p></td>
<td> a <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>flags</code></em>&#160;:</span></p></td>
<td> which types of children are to be visited, one of 
    <a class="link" href="glib-N-ary-Trees.html#G-TRAVERSE-ALL:CAPS"><code class="literal">G_TRAVERSE_ALL</code></a>, <a class="link" href="glib-N-ary-Trees.html#G-TRAVERSE-LEAVES:CAPS"><code class="literal">G_TRAVERSE_LEAVES</code></a> and <a class="link" href="glib-N-ary-Trees.html#G-TRAVERSE-NON-LEAVES:CAPS"><code class="literal">G_TRAVERSE_NON_LEAVES</code></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>func</code></em>&#160;:</span></p></td>
<td> the function to call for each visited node
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>data</code></em>&#160;:</span></p></td>
<td> user data to pass to the function
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3397806"></a><h3>
<a name="GNodeForeachFunc"></a>GNodeForeachFunc ()</h3>
<a class="indexterm" name="id3397819"></a><pre class="programlisting">void                (*GNodeForeachFunc)                 (<a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a> *node,
                                                         <a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> data);</pre>
<p>
Specifies the type of function passed to <a class="link" href="glib-N-ary-Trees.html#g-node-children-foreach"><code class="function">g_node_children_foreach()</code></a>.
The function is called with each child node, together with the user data
passed to <a class="link" href="glib-N-ary-Trees.html#g-node-children-foreach"><code class="function">g_node_children_foreach()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>node</code></em>&#160;:</span></p></td>
<td>a <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>data</code></em>&#160;:</span></p></td>
<td>user data passed to <a class="link" href="glib-N-ary-Trees.html#g-node-children-foreach"><code class="function">g_node_children_foreach()</code></a>.


</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3397930"></a><h3>
<a name="g-node-get-root"></a>g_node_get_root ()</h3>
<a class="indexterm" name="id3397942"></a><pre class="programlisting"><a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a>*              g_node_get_root                     (<a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a> *node);</pre>
<p>
Gets the root of a tree.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>node</code></em>&#160;:</span></p></td>
<td> a <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
<td> the root of the tree
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3398011"></a><h3>
<a name="g-node-find"></a>g_node_find ()</h3>
<a class="indexterm" name="id3398023"></a><pre class="programlisting"><a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a>*              g_node_find                         (<a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a> *root,
                                                         <a class="link" href="glib-Balanced-Binary-Trees.html#GTraverseType">GTraverseType</a> order,
                                                         <a class="link" href="glib-N-ary-Trees.html#GTraverseFlags">GTraverseFlags</a> flags,
                                                         <a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> data);</pre>
<p>
Finds a <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> in a tree.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>root</code></em>&#160;:</span></p></td>
<td> the root <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> of the tree to search
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>order</code></em>&#160;:</span></p></td>
<td> the order in which nodes are visited - <a class="link" href="glib-Balanced-Binary-Trees.html#G-IN-ORDER:CAPS"><code class="literal">G_IN_ORDER</code></a>, 
    <a class="link" href="glib-Balanced-Binary-Trees.html#G-PRE-ORDER:CAPS"><code class="literal">G_PRE_ORDER</code></a>, <a class="link" href="glib-Balanced-Binary-Trees.html#G-POST-ORDER:CAPS"><code class="literal">G_POST_ORDER</code></a>, or <a class="link" href="glib-Balanced-Binary-Trees.html#G-LEVEL-ORDER:CAPS"><code class="literal">G_LEVEL_ORDER</code></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>flags</code></em>&#160;:</span></p></td>
<td> which types of children are to be searched, one of 
    <a class="link" href="glib-N-ary-Trees.html#G-TRAVERSE-ALL:CAPS"><code class="literal">G_TRAVERSE_ALL</code></a>, <a class="link" href="glib-N-ary-Trees.html#G-TRAVERSE-LEAVES:CAPS"><code class="literal">G_TRAVERSE_LEAVES</code></a> and <a class="link" href="glib-N-ary-Trees.html#G-TRAVERSE-NON-LEAVES:CAPS"><code class="literal">G_TRAVERSE_NON_LEAVES</code></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>data</code></em>&#160;:</span></p></td>
<td> the data to find
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
<td> the found <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if the data is not found
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3398259"></a><h3>
<a name="g-node-find-child"></a>g_node_find_child ()</h3>
<a class="indexterm" name="id3398272"></a><pre class="programlisting"><a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a>*              g_node_find_child                   (<a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a> *node,
                                                         <a class="link" href="glib-N-ary-Trees.html#GTraverseFlags">GTraverseFlags</a> flags,
                                                         <a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> data);</pre>
<p>
Finds the first child of a <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> with the given data.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>node</code></em>&#160;:</span></p></td>
<td> a <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>flags</code></em>&#160;:</span></p></td>
<td> which types of children are to be searched, one of 
    <a class="link" href="glib-N-ary-Trees.html#G-TRAVERSE-ALL:CAPS"><code class="literal">G_TRAVERSE_ALL</code></a>, <a class="link" href="glib-N-ary-Trees.html#G-TRAVERSE-LEAVES:CAPS"><code class="literal">G_TRAVERSE_LEAVES</code></a> and <a class="link" href="glib-N-ary-Trees.html#G-TRAVERSE-NON-LEAVES:CAPS"><code class="literal">G_TRAVERSE_NON_LEAVES</code></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>data</code></em>&#160;:</span></p></td>
<td> the data to find
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
<td> the found child <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if the data is not found
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3398444"></a><h3>
<a name="g-node-child-index"></a>g_node_child_index ()</h3>
<a class="indexterm" name="id3398457"></a><pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gint">gint</a>                g_node_child_index                  (<a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a> *node,
                                                         <a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> data);</pre>
<p>
Gets the position of the first child of a <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> 
which contains the given data.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>node</code></em>&#160;:</span></p></td>
<td> a <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>data</code></em>&#160;:</span></p></td>
<td> the data to find
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
<td> the index of the child of <em class="parameter"><code>node</code></em> which contains 
    <em class="parameter"><code>data</code></em>, or -1 if the data is not found
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3398568"></a><h3>
<a name="g-node-child-position"></a>g_node_child_position ()</h3>
<a class="indexterm" name="id3398581"></a><pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gint">gint</a>                g_node_child_position               (<a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a> *node,
                                                         <a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a> *child);</pre>
<p>
Gets the position of a <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> with respect to its siblings.
<em class="parameter"><code>child</code></em> must be a child of <em class="parameter"><code>node</code></em>. The first child is numbered 0, 
the second 1, and so on.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>node</code></em>&#160;:</span></p></td>
<td> a <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>child</code></em>&#160;:</span></p></td>
<td> a child of <em class="parameter"><code>node</code></em>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
<td> the position of <em class="parameter"><code>child</code></em> with respect to its siblings
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3398705"></a><h3>
<a name="g-node-first-child"></a>g_node_first_child()</h3>
<a class="indexterm" name="id3398718"></a><pre class="programlisting">#define             g_node_first_child(node)</pre>
<p>
Gets the first child of a <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>node</code></em>&#160;:</span></p></td>
<td> a <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
<td> the first child of <em class="parameter"><code>node</code></em>, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if <em class="parameter"><code>node</code></em> is <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> 
    or has no children
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3398814"></a><h3>
<a name="g-node-last-child"></a>g_node_last_child ()</h3>
<a class="indexterm" name="id3398828"></a><pre class="programlisting"><a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a>*              g_node_last_child                   (<a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a> *node);</pre>
<p>
Gets the last child of a <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>node</code></em>&#160;:</span></p></td>
<td> a <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> (must not be <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>)
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
<td> the last child of <em class="parameter"><code>node</code></em>, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if <em class="parameter"><code>node</code></em> has no children
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3398936"></a><h3>
<a name="g-node-nth-child"></a>g_node_nth_child ()</h3>
<a class="indexterm" name="id3398948"></a><pre class="programlisting"><a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a>*              g_node_nth_child                    (<a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a> *node,
                                                         <a class="link" href="glib-Basic-Types.html#guint">guint</a> n);</pre>
<p>
Gets a child of a <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>, using the given index.
The first child is at index 0. If the index is 
too big, <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> is returned.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>node</code></em>&#160;:</span></p></td>
<td> a <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>n</code></em>&#160;:</span></p></td>
<td> the index of the desired child
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
<td> the child of <em class="parameter"><code>node</code></em> at index <em class="parameter"><code>n</code></em>
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3399069"></a><h3>
<a name="g-node-first-sibling"></a>g_node_first_sibling ()</h3>
<a class="indexterm" name="id3399082"></a><pre class="programlisting"><a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a>*              g_node_first_sibling                (<a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a> *node);</pre>
<p>
Gets the first sibling of a <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>.
This could possibly be the node itself.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>node</code></em>&#160;:</span></p></td>
<td> a <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
<td> the first sibling of <em class="parameter"><code>node</code></em>
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3399165"></a><h3>
<a name="g-node-next-sibling"></a>g_node_next_sibling()</h3>
<a class="indexterm" name="id3399179"></a><pre class="programlisting">#define             g_node_next_sibling(node)</pre>
<p>
Gets the next sibling of a <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>node</code></em>&#160;:</span></p></td>
<td> a <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
<td> the next sibling of <em class="parameter"><code>node</code></em>, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if <em class="parameter"><code>node</code></em> is <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3399274"></a><h3>
<a name="g-node-prev-sibling"></a>g_node_prev_sibling()</h3>
<a class="indexterm" name="id3399288"></a><pre class="programlisting">#define             g_node_prev_sibling(node)</pre>
<p>
Gets the previous sibling of a <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>node</code></em>&#160;:</span></p></td>
<td> a <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
<td> the previous sibling of <em class="parameter"><code>node</code></em>, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if <em class="parameter"><code>node</code></em> is <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3399383"></a><h3>
<a name="g-node-last-sibling"></a>g_node_last_sibling ()</h3>
<a class="indexterm" name="id3399396"></a><pre class="programlisting"><a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a>*              g_node_last_sibling                 (<a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a> *node);</pre>
<p>
Gets the last sibling of a <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>.
This could possibly be the node itself.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>node</code></em>&#160;:</span></p></td>
<td> a <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
<td> the last sibling of <em class="parameter"><code>node</code></em>
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3399478"></a><h3>
<a name="G-NODE-IS-LEAF:CAPS"></a>G_NODE_IS_LEAF()</h3>
<a class="indexterm" name="id3399491"></a><pre class="programlisting">#define	 G_NODE_IS_LEAF(node)	(((GNode*) (node))-&gt;children == NULL)
</pre>
<p>
Returns <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if a <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> is a leaf node.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>node</code></em>&#160;:</span></p></td>
<td> a <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
<td> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> is a leaf node 
    (i.e. it has no children)
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3399584"></a><h3>
<a name="G-NODE-IS-ROOT:CAPS"></a>G_NODE_IS_ROOT()</h3>
<a class="indexterm" name="id3399596"></a><pre class="programlisting">#define             G_NODE_IS_ROOT(node)</pre>
<p>
Returns <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if a <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> is the root of a tree.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>node</code></em>&#160;:</span></p></td>
<td> a <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
<td> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> is the root of a tree 
    (i.e. it has no parent or siblings)
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3399689"></a><h3>
<a name="g-node-depth"></a>g_node_depth ()</h3>
<a class="indexterm" name="id3399701"></a><pre class="programlisting"><a class="link" href="glib-Basic-Types.html#guint">guint</a>               g_node_depth                        (<a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a> *node);</pre>
<p>
Gets the depth of a <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>.
</p>
<p>
If <em class="parameter"><code>node</code></em> is <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> the depth is 0. The root node has a depth of 1.
For the children of the root node the depth is 2. And so on.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>node</code></em>&#160;:</span></p></td>
<td> a <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
<td> the depth of the <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3399806"></a><h3>
<a name="g-node-n-nodes"></a>g_node_n_nodes ()</h3>
<a class="indexterm" name="id3399819"></a><pre class="programlisting"><a class="link" href="glib-Basic-Types.html#guint">guint</a>               g_node_n_nodes                      (<a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a> *root,
                                                         <a class="link" href="glib-N-ary-Trees.html#GTraverseFlags">GTraverseFlags</a> flags);</pre>
<p>
Gets the number of nodes in a tree.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>root</code></em>&#160;:</span></p></td>
<td> a <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>flags</code></em>&#160;:</span></p></td>
<td> which types of children are to be counted, one of 
    <a class="link" href="glib-N-ary-Trees.html#G-TRAVERSE-ALL:CAPS"><code class="literal">G_TRAVERSE_ALL</code></a>, <a class="link" href="glib-N-ary-Trees.html#G-TRAVERSE-LEAVES:CAPS"><code class="literal">G_TRAVERSE_LEAVES</code></a> and <a class="link" href="glib-N-ary-Trees.html#G-TRAVERSE-NON-LEAVES:CAPS"><code class="literal">G_TRAVERSE_NON_LEAVES</code></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
<td> the number of nodes in the tree
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3399942"></a><h3>
<a name="g-node-n-children"></a>g_node_n_children ()</h3>
<a class="indexterm" name="id3399955"></a><pre class="programlisting"><a class="link" href="glib-Basic-Types.html#guint">guint</a>               g_node_n_children                   (<a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a> *node);</pre>
<p>
Gets the number of children of a <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>node</code></em>&#160;:</span></p></td>
<td> a <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
<td> the number of children of <em class="parameter"><code>node</code></em>
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3400037"></a><h3>
<a name="g-node-is-ancestor"></a>g_node_is_ancestor ()</h3>
<a class="indexterm" name="id3400050"></a><pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean">gboolean</a>            g_node_is_ancestor                  (<a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a> *node,
                                                         <a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a> *descendant);</pre>
<p>
Returns <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if <em class="parameter"><code>node</code></em> is an ancestor of <em class="parameter"><code>descendant</code></em>.
This is true if node is the parent of <em class="parameter"><code>descendant</code></em>, 
or if node is the grandparent of <em class="parameter"><code>descendant</code></em> etc.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>node</code></em>&#160;:</span></p></td>
<td> a <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>descendant</code></em>&#160;:</span></p></td>
<td> a <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
<td> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if <em class="parameter"><code>node</code></em> is an ancestor of <em class="parameter"><code>descendant</code></em>
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3400204"></a><h3>
<a name="g-node-max-height"></a>g_node_max_height ()</h3>
<a class="indexterm" name="id3400217"></a><pre class="programlisting"><a class="link" href="glib-Basic-Types.html#guint">guint</a>               g_node_max_height                   (<a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a> *root);</pre>
<p>
Gets the maximum height of all branches beneath a <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>.
This is the maximum distance from the <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> to all leaf nodes.
</p>
<p>
If <em class="parameter"><code>root</code></em> is <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>, 0 is returned. If <em class="parameter"><code>root</code></em> has no children, 
1 is returned. If <em class="parameter"><code>root</code></em> has children, 2 is returned. And so on.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>root</code></em>&#160;:</span></p></td>
<td> a <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
<td> the maximum height of the tree beneath <em class="parameter"><code>root</code></em>
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3400342"></a><h3>
<a name="g-node-unlink"></a>g_node_unlink ()</h3>
<a class="indexterm" name="id3400354"></a><pre class="programlisting">void                g_node_unlink                       (<a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a> *node);</pre>
<p>
Unlinks a <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> from a tree, resulting in two separate trees.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><em class="parameter"><code>node</code></em>&#160;:</span></p></td>
<td> the <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> to unlink, which becomes the root of a new tree
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3400421"></a><h3>
<a name="g-node-destroy"></a>g_node_destroy ()</h3>
<a class="indexterm" name="id3400434"></a><pre class="programlisting">void                g_node_destroy                      (<a class="link" href="glib-N-ary-Trees.html#GNode">GNode</a> *root);</pre>
<p>
Removes <em class="parameter"><code>root</code></em> and its children from the tree, freeing any memory
allocated.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><em class="parameter"><code>root</code></em>&#160;:</span></p></td>
<td> the root of the tree/subtree to destroy
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3400491"></a><h3>
<a name="g-node-push-allocator"></a>g_node_push_allocator ()</h3>
<a class="indexterm" name="id3400506"></a><pre class="programlisting">void                g_node_push_allocator               (<a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> dummy);</pre>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Warning</h3>
<p><code class="literal">g_node_push_allocator</code> has been deprecated since version 2.10 and should not be used in newly-written code. It does nothing, since <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> has been converted 
  to the <a class="link" href="glib-Memory-Slices.html" title="Memory Slices">slice allocator</a></p>
</div>
<p>
Sets the allocator to use to allocate <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> elements.
Use <a class="link" href="glib-N-ary-Trees.html#g-node-pop-allocator"><code class="function">g_node_pop_allocator()</code></a> to restore the previous allocator.
</p>
<p>
Note that this function is not available if GLib has been compiled
with <code class="option">--disable-mem-pools</code>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><em class="parameter"><code>dummy</code></em>&#160;:</span></p></td>
<td>the <a class="link" href="glib-Memory-Allocators.html#GAllocator"><span class="type">GAllocator</span></a> to use when allocating <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> elements.
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3400626"></a><h3>
<a name="g-node-pop-allocator"></a>g_node_pop_allocator ()</h3>
<a class="indexterm" name="id3400641"></a><pre class="programlisting">void                g_node_pop_allocator                (void);</pre>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Warning</h3>
<p><code class="literal">g_node_pop_allocator</code> has been deprecated since version 2.10 and should not be used in newly-written code. It does nothing, since <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> has been converted 
  to the <a class="link" href="glib-Memory-Slices.html" title="Memory Slices">slice allocator</a></p>
</div>
<p>
Restores the previous <a class="link" href="glib-Memory-Allocators.html#GAllocator"><span class="type">GAllocator</span></a>, used when allocating <a class="link" href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> elements.
</p>
<p>
Note that this function is not available if GLib has been compiled
with <code class="option">--disable-mem-pools</code>
</p>
</div>
</div>
<div class="refsect1" lang="en">
<a name="id3400716"></a><div class="refsect2" lang="en"><a name="id3400717"></a></div>
<hr>
<div class="refsect2" lang="en"><a name="id3400718"></a></div>
</div>
</div>
</body>
</html>
